home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / Speech.a < prev    next >
Text File  |  1996-05-01  |  11KB  |  492 lines

  1. ;
  2. ;    File:        Speech.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__SPEECH__') = 'UNDEFINED' THEN
  19. __SPEECH__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  25.     include 'Memory.a'
  26.     ENDIF
  27.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  28.     include 'Files.a'
  29.     ENDIF
  30.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  31.  
  32. kTextToSpeechSynthType            EQU        'ttsc'
  33. kTextToSpeechVoiceType            EQU        'ttvd'
  34. kTextToSpeechVoiceFileType        EQU        'ttvf'
  35. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  36.  
  37. kNoEndingProsody                EQU        1
  38. kNoSpeechInterrupt                EQU        2
  39. kPreflightThenPause                EQU        4
  40.  
  41. kImmediate                        EQU        0
  42. kEndOfWord                        EQU        1
  43. kEndOfSentence                    EQU        2
  44. ; ------------------------------------------
  45. ;  GetSpeechInfo & SetSpeechInfo selectors    
  46. ; ------------------------------------------
  47.  
  48. soStatus                        EQU        'stat'
  49. soErrors                        EQU        'erro'
  50. soInputMode                        EQU        'inpt'
  51. soCharacterMode                    EQU        'char'
  52. soNumberMode                    EQU        'nmbr'
  53. soRate                            EQU        'rate'
  54. soPitchBase                        EQU        'pbas'
  55. soPitchMod                        EQU        'pmod'
  56. soVolume                        EQU        'volm'
  57. soSynthType                        EQU        'vers'
  58. soRecentSync                    EQU        'sync'
  59. soPhonemeSymbols                EQU        'phsy'
  60. soCurrentVoice                    EQU        'cvox'
  61. soCommandDelimiter                EQU        'dlim'
  62. soReset                            EQU        'rset'
  63. soCurrentA5                        EQU        'myA5'
  64. soRefCon                        EQU        'refc'
  65. soTextDoneCallBack                EQU        'tdcb'
  66. soSpeechDoneCallBack            EQU        'sdcb'
  67. soSyncCallBack                    EQU        'sycb'
  68. soErrorCallBack                    EQU        'ercb'
  69. soPhonemeCallBack                EQU        'phcb'
  70. soWordCallBack                    EQU        'wdcb'
  71. soSynthExtension                EQU        'xtnd'
  72. soSoundOutput                    EQU        'sndo'
  73. ; ------------------------------------------
  74. ;  Speaking Mode Constants                     
  75. ; ------------------------------------------
  76.  
  77. modeText                        EQU        'TEXT'                ; input mode constants                     
  78. modePhonemes                    EQU        'PHON'
  79. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  80. modeLiteral                        EQU        'LTRL'
  81.  
  82. soVoiceDescription                EQU        'info'
  83. soVoiceFile                        EQU        'fref'
  84. SpeechChannelRecord        RECORD 0
  85. data                     ds.l    1                ; offset: $0 (0) <-- really an array of length one
  86. sizeof                     EQU *                    ; size:   $4 (4)
  87.                         ENDR
  88. ; typedef struct SpeechChannelRecord *    SpeechChannel
  89.  
  90. VoiceSpec                RECORD 0
  91. creator                     ds.l    1                ; offset: $0 (0)
  92. id                         ds.l    1                ; offset: $4 (4)
  93. sizeof                     EQU *                    ; size:   $8 (8)
  94.                         ENDR
  95.  
  96. kNeuter                            EQU        0
  97. kMale                            EQU        1
  98. kFemale                            EQU        2
  99. VoiceDescription        RECORD 0
  100. length                     ds.l    1                ; offset: $0 (0)
  101. voice                     ds        VoiceSpec        ; offset: $4 (4)
  102. version                     ds.l    1                ; offset: $C (12)
  103. name                     ds        Str63            ; offset: $10 (16)
  104. comment                     ds        Str255            ; offset: $50 (80)
  105. gender                     ds.w    1                ; offset: $150 (336)
  106. age                         ds.w    1                ; offset: $152 (338)
  107. script                     ds.w    1                ; offset: $154 (340)
  108. language                 ds.w    1                ; offset: $156 (342)
  109. region                     ds.w    1                ; offset: $158 (344)
  110. reserved                 ds.l    4                ; offset: $15A (346)
  111. sizeof                     EQU *                    ; size:   $16A (362)
  112.                         ENDR
  113. VoiceFileInfo            RECORD 0
  114. fileSpec                 ds        FSSpec            ; offset: $0 (0)
  115. resID                     ds.w    1                ; offset: $46 (70)
  116. sizeof                     EQU *                    ; size:   $48 (72)
  117.                         ENDR
  118. SpeechStatusInfo        RECORD 0
  119. outputBusy                 ds.b    1                ; offset: $0 (0)
  120. outputPaused             ds.b    1                ; offset: $1 (1)
  121. inputBytesLeft             ds.l    1                ; offset: $2 (2)
  122. phonemeCode                 ds.w    1                ; offset: $6 (6)
  123. sizeof                     EQU *                    ; size:   $8 (8)
  124.                         ENDR
  125. SpeechErrorInfo            RECORD 0
  126. count                     ds.w    1                ; offset: $0 (0)
  127. oldest                     ds.w    1                ; offset: $2 (2)
  128. oldPos                     ds.l    1                ; offset: $4 (4)
  129. newest                     ds.w    1                ; offset: $8 (8)
  130. newPos                     ds.l    1                ; offset: $A (10)
  131. sizeof                     EQU *                    ; size:   $E (14)
  132.                         ENDR
  133. SpeechVersionInfo        RECORD 0
  134. synthType                 ds.l    1                ; offset: $0 (0)
  135. synthSubType             ds.l    1                ; offset: $4 (4)
  136. synthManufacturer         ds.l    1                ; offset: $8 (8)
  137. synthFlags                 ds.l    1                ; offset: $C (12)
  138. synthVersion             ds        NumVersion        ; offset: $10 (16)
  139. sizeof                     EQU *                    ; size:   $14 (20)
  140.                         ENDR
  141. PhonemeInfo                RECORD 0
  142. opcode                     ds.w    1                ; offset: $0 (0)
  143. phStr                     ds        Str15            ; offset: $2 (2)
  144. exampleStr                 ds        Str31            ; offset: $12 (18)
  145. hiliteStart                 ds.w    1                ; offset: $32 (50)
  146. hiliteEnd                 ds.w    1                ; offset: $34 (52)
  147. sizeof                     EQU *                    ; size:   $36 (54)
  148.                         ENDR
  149. PhonemeDescriptor        RECORD 0
  150. phonemeCount             ds.w    1                ; offset: $0 (0)
  151. thePhonemes                 ds        PhonemeInfo        ; offset: $2 (2) <-- really an array of length one
  152. sizeof                     EQU *                    ; size:   $38 (56)
  153.                         ENDR
  154. SpeechXtndData            RECORD 0
  155. synthCreator             ds.l    1                ; offset: $0 (0)
  156. synthData                 ds.b    2                ; offset: $4 (4)
  157. sizeof                     EQU *                    ; size:   $6 (6)
  158.                         ENDR
  159. DelimiterInfo            RECORD 0
  160. startDelimiter             ds.b    2                ; offset: $0 (0)
  161. endDelimiter             ds.b    2                ; offset: $2 (2)
  162. sizeof                     EQU *                    ; size:   $4 (4)
  163.                         ENDR
  164. ;
  165. ; pascal NumVersion SpeechManagerVersion(void )
  166. ;
  167.     IF ¨ GENERATINGCFM THEN
  168.         Macro
  169.         _SpeechManagerVersion
  170.             move.l              #$0000000C,D0
  171.             dc.w                $A800
  172.         EndM
  173.     ELSE
  174.         IMPORT_CFM_FUNCTION SpeechManagerVersion
  175.     ENDIF
  176.  
  177. ;
  178. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  179. ;
  180.     IF ¨ GENERATINGCFM THEN
  181.         Macro
  182.         _MakeVoiceSpec
  183.             move.l              #$0604000C,D0
  184.             dc.w                $A800
  185.         EndM
  186.     ELSE
  187.         IMPORT_CFM_FUNCTION MakeVoiceSpec
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal OSErr CountVoices(short *numVoices)
  192. ;
  193.     IF ¨ GENERATINGCFM THEN
  194.         Macro
  195.         _CountVoices
  196.             move.l              #$0108000C,D0
  197.             dc.w                $A800
  198.         EndM
  199.     ELSE
  200.         IMPORT_CFM_FUNCTION CountVoices
  201.     ENDIF
  202.  
  203. ;
  204. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  205. ;
  206.     IF ¨ GENERATINGCFM THEN
  207.         Macro
  208.         _GetIndVoice
  209.             move.l              #$030C000C,D0
  210.             dc.w                $A800
  211.         EndM
  212.     ELSE
  213.         IMPORT_CFM_FUNCTION GetIndVoice
  214.     ENDIF
  215.  
  216. ;
  217. ; pascal OSErr GetVoiceDescription(VoiceSpec *voice, VoiceDescription *info, long infoLength)
  218. ;
  219.     IF ¨ GENERATINGCFM THEN
  220.         Macro
  221.         _GetVoiceDescription
  222.             move.l              #$0610000C,D0
  223.             dc.w                $A800
  224.         EndM
  225.     ELSE
  226.         IMPORT_CFM_FUNCTION GetVoiceDescription
  227.     ENDIF
  228.  
  229. ;
  230. ; pascal OSErr GetVoiceInfo(VoiceSpec *voice, OSType selector, void *voiceInfo)
  231. ;
  232.     IF ¨ GENERATINGCFM THEN
  233.         Macro
  234.         _GetVoiceInfo
  235.             move.l              #$0614000C,D0
  236.             dc.w                $A800
  237.         EndM
  238.     ELSE
  239.         IMPORT_CFM_FUNCTION GetVoiceInfo
  240.     ENDIF
  241.  
  242. ;
  243. ; pascal OSErr NewSpeechChannel(VoiceSpec *voice, SpeechChannel *chan)
  244. ;
  245.     IF ¨ GENERATINGCFM THEN
  246.         Macro
  247.         _NewSpeechChannel
  248.             move.l              #$0418000C,D0
  249.             dc.w                $A800
  250.         EndM
  251.     ELSE
  252.         IMPORT_CFM_FUNCTION NewSpeechChannel
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  257. ;
  258.     IF ¨ GENERATINGCFM THEN
  259.         Macro
  260.         _DisposeSpeechChannel
  261.             move.l              #$021C000C,D0
  262.             dc.w                $A800
  263.         EndM
  264.     ELSE
  265.         IMPORT_CFM_FUNCTION DisposeSpeechChannel
  266.     ENDIF
  267.  
  268. ;
  269. ; pascal OSErr SpeakString(StringPtr s)
  270. ;
  271.     IF ¨ GENERATINGCFM THEN
  272.         Macro
  273.         _SpeakString
  274.             move.l              #$0220000C,D0
  275.             dc.w                $A800
  276.         EndM
  277.     ELSE
  278.         IMPORT_CFM_FUNCTION SpeakString
  279.     ENDIF
  280.  
  281. ;
  282. ; pascal OSErr SpeakText(SpeechChannel chan, Ptr textBuf, long textBytes)
  283. ;
  284.     IF ¨ GENERATINGCFM THEN
  285.         Macro
  286.         _SpeakText
  287.             move.l              #$0624000C,D0
  288.             dc.w                $A800
  289.         EndM
  290.     ELSE
  291.         IMPORT_CFM_FUNCTION SpeakText
  292.     ENDIF
  293.  
  294. ;
  295. ; pascal OSErr SpeakBuffer(SpeechChannel chan, Ptr textBuf, long textBytes, long controlFlags)
  296. ;
  297.     IF ¨ GENERATINGCFM THEN
  298.         Macro
  299.         _SpeakBuffer
  300.             move.l              #$0828000C,D0
  301.             dc.w                $A800
  302.         EndM
  303.     ELSE
  304.         IMPORT_CFM_FUNCTION SpeakBuffer
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal OSErr StopSpeech(SpeechChannel chan)
  309. ;
  310.     IF ¨ GENERATINGCFM THEN
  311.         Macro
  312.         _StopSpeech
  313.             move.l              #$022C000C,D0
  314.             dc.w                $A800
  315.         EndM
  316.     ELSE
  317.         IMPORT_CFM_FUNCTION StopSpeech
  318.     ENDIF
  319.  
  320. ;
  321. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  322. ;
  323.     IF ¨ GENERATINGCFM THEN
  324.         Macro
  325.         _StopSpeechAt
  326.             move.l              #$0430000C,D0
  327.             dc.w                $A800
  328.         EndM
  329.     ELSE
  330.         IMPORT_CFM_FUNCTION StopSpeechAt
  331.     ENDIF
  332.  
  333. ;
  334. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  335. ;
  336.     IF ¨ GENERATINGCFM THEN
  337.         Macro
  338.         _PauseSpeechAt
  339.             move.l              #$0434000C,D0
  340.             dc.w                $A800
  341.         EndM
  342.     ELSE
  343.         IMPORT_CFM_FUNCTION PauseSpeechAt
  344.     ENDIF
  345.  
  346. ;
  347. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  348. ;
  349.     IF ¨ GENERATINGCFM THEN
  350.         Macro
  351.         _ContinueSpeech
  352.             move.l              #$0238000C,D0
  353.             dc.w                $A800
  354.         EndM
  355.     ELSE
  356.         IMPORT_CFM_FUNCTION ContinueSpeech
  357.     ENDIF
  358.  
  359. ;
  360. ; pascal short SpeechBusy(void )
  361. ;
  362.     IF ¨ GENERATINGCFM THEN
  363.         Macro
  364.         _SpeechBusy
  365.             move.l              #$003C000C,D0
  366.             dc.w                $A800
  367.         EndM
  368.     ELSE
  369.         IMPORT_CFM_FUNCTION SpeechBusy
  370.     ENDIF
  371.  
  372. ;
  373. ; pascal short SpeechBusySystemWide(void )
  374. ;
  375.     IF ¨ GENERATINGCFM THEN
  376.         Macro
  377.         _SpeechBusySystemWide
  378.             move.l              #$0040000C,D0
  379.             dc.w                $A800
  380.         EndM
  381.     ELSE
  382.         IMPORT_CFM_FUNCTION SpeechBusySystemWide
  383.     ENDIF
  384.  
  385. ;
  386. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  387. ;
  388.     IF ¨ GENERATINGCFM THEN
  389.         Macro
  390.         _SetSpeechRate
  391.             move.l              #$0444000C,D0
  392.             dc.w                $A800
  393.         EndM
  394.     ELSE
  395.         IMPORT_CFM_FUNCTION SetSpeechRate
  396.     ENDIF
  397.  
  398. ;
  399. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  400. ;
  401.     IF ¨ GENERATINGCFM THEN
  402.         Macro
  403.         _GetSpeechRate
  404.             move.l              #$0448000C,D0
  405.             dc.w                $A800
  406.         EndM
  407.     ELSE
  408.         IMPORT_CFM_FUNCTION GetSpeechRate
  409.     ENDIF
  410.  
  411. ;
  412. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  413. ;
  414.     IF ¨ GENERATINGCFM THEN
  415.         Macro
  416.         _SetSpeechPitch
  417.             move.l              #$044C000C,D0
  418.             dc.w                $A800
  419.         EndM
  420.     ELSE
  421.         IMPORT_CFM_FUNCTION SetSpeechPitch
  422.     ENDIF
  423.  
  424. ;
  425. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  426. ;
  427.     IF ¨ GENERATINGCFM THEN
  428.         Macro
  429.         _GetSpeechPitch
  430.             move.l              #$0450000C,D0
  431.             dc.w                $A800
  432.         EndM
  433.     ELSE
  434.         IMPORT_CFM_FUNCTION GetSpeechPitch
  435.     ENDIF
  436.  
  437. ;
  438. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  439. ;
  440.     IF ¨ GENERATINGCFM THEN
  441.         Macro
  442.         _SetSpeechInfo
  443.             move.l              #$0654000C,D0
  444.             dc.w                $A800
  445.         EndM
  446.     ELSE
  447.         IMPORT_CFM_FUNCTION SetSpeechInfo
  448.     ENDIF
  449.  
  450. ;
  451. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  452. ;
  453.     IF ¨ GENERATINGCFM THEN
  454.         Macro
  455.         _GetSpeechInfo
  456.             move.l              #$0658000C,D0
  457.             dc.w                $A800
  458.         EndM
  459.     ELSE
  460.         IMPORT_CFM_FUNCTION GetSpeechInfo
  461.     ENDIF
  462.  
  463. ;
  464. ; pascal OSErr TextToPhonemes(SpeechChannel chan, Ptr textBuf, long textBytes, Handle phonemeBuf, long *phonemeBytes)
  465. ;
  466.     IF ¨ GENERATINGCFM THEN
  467.         Macro
  468.         _TextToPhonemes
  469.             move.l              #$0A5C000C,D0
  470.             dc.w                $A800
  471.         EndM
  472.     ELSE
  473.         IMPORT_CFM_FUNCTION TextToPhonemes
  474.     ENDIF
  475.  
  476. ;
  477. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  478. ;
  479.     IF ¨ GENERATINGCFM THEN
  480.         Macro
  481.         _UseDictionary
  482.             move.l              #$0460000C,D0
  483.             dc.w                $A800
  484.         EndM
  485.     ELSE
  486.         IMPORT_CFM_FUNCTION UseDictionary
  487.     ENDIF
  488.  
  489.     ENDIF
  490.     ENDIF ; __SPEECH__ 
  491.  
  492.